<div class="wrapper wrapper-content animated fadeInRight">
    <div class="alert alert-success">
        您必须选择一个已授权您小程序的微信用户 这个用户拥有这个公司的管理权限 请仔细核对添加 如果为找到对应的用户 请先让负则您要添加公司的管理员先授权您小程序 授权方法：登录您的小程序 会弹出询问 点击允许即可
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox-content">
                <div class="row">
                    <form action="<?=url('job.company/create')?>" id="form-create" method="post" class="form-horizontal"
                          role="form">
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>昵称：</label>
                            <div class="col-sm-9">
                                <input id="username" type="text" name="username"  value="" placeholder="请单击选择会员"  class="form-control"/>
                                <input type="hidden" value="" name="user_id" id="user_id">
                                <button id="show-btn1" style="display: none" type="button" mini="load" w="95%" h="95%" href="<?=url('miniapp/user.user/select')?>" class="btn btn-w-m btn-info">选择酒店</button>
                                <script>
                                    $("#username").focus(function () {
                                        $("#show-btn1").click();
                                    })
                                    function seleUser(user_name,user_id){
                                        layer.closeAll();
                                        layer.msg('操作成功！');
                                        $("#username").val(user_name);
                                        $("#user_id").val(user_id);
                                    }
                                </script>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>经度纬度：</label>
                            <div class="col-sm-3"  style="margin-right: 0; padding-right: 0;">
                                <input type="text" readonly style="background-color: transparent;" class="form-control"  value="<?=isset($detail->lat)?$detail->lat:'';?>" placeholder="" id="lat" name="lat"/>
                            </div>
                            <div class="col-sm-1" style="margin: 0;padding: 0;width: 1rem; line-height: 3rem">--</div>
                            <div class="col-sm-3" style="margin-left: 0; padding-left: 0;" >
                                <input type="text"  readonly style="background-color: transparent;" class="form-control" value="<?=isset($detail->lng)?$detail->lng:'';?>" placeholder="" id="lng" name="lng"/>
                            </div>
                            <div class="col-sm-2">
                                <button type="button"  mini="load" w="1000px" h="800px" href="<?=url('index/map',['callback'=>'showLatLng']);?>?lat=<?=isset($detail->lat)?$detail->lat:'0';?>&lng=<?=isset($detail->lng)?$detail->lng:'0';?>" class="btn btn-w-m btn-info">选择地址</button>
                            </div>
                            <script>
                                function showLatLng(lat,lng,addr){
                                    layer.closeAll();
                                    layer.msg('选取经纬度成功！');
                                    $("#lat").val(lat);
                                    $("#lng").val(lng);
                                    $("#address").val(addr);
                                }
                            </script>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>地址：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->address)?$detail->address:''?>"
                                       placeholder="" id="address" name="address" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>响亮的口号：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->title)?$detail->title:''?>" placeholder=""
                                       id="title" name="title" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>公司名称：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->company_name)?$detail->company_name:''?>"
                                       placeholder="" id="company_name" name="company_name" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>主营业务：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->main_business)?$detail->main_business:''?>"
                                       placeholder="" id="main_business" name="main_business" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>公司简称：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->sort_name)?$detail->sort_name:''?>"
                                       placeholder="" id="sort_name" name="sort_name" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>年份：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->bg_year)?$detail->bg_year:''?>" placeholder="" id="bg_year" name="bg_year" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>公司负责人：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->name)?$detail->name:''?>" placeholder="" id="name" name="name" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>负责人联系方式：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->tel)?$detail->tel:''?>" placeholder="" id="tel" name="tel" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span class="c-red">*</span>负责人职位：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->zhiwu)?$detail->zhiwu:''?>" placeholder="" id="zhiwu" name="zhiwu" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>vip等级：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->vip)?$detail->vip:''?>" placeholder=""
                                       id="vip" name="vip" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label"><span class="c-red">*</span>vip过期时间：</label>
                            <div class="col-sm-9">
                                <input  value="<?=isset($detail->vip_expire)?date('Y-m-d H:i:s',$detail->vip_expire):''?>"   name="vip_expire" id="vip_expire"  class="laydate-icon form-control layer-date">

                            </div>
                        </div>
                        <script>
                            laydate({
                                elem: '#vip_expire',
                                event: 'focus' ,
                                format: 'YYYY-MM-DD hh:mm:ss',
                                istime: true
                            });
                        </script>


                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>所在区域：</label>
                            <div class="col-sm-9">
                                <select name="region" class="form-control">
                                        <option value="0">请选择</option>
                                        <?php foreach($area as $val) { ?>
                                             <option value="<?=$val->area_id?>"><?=$val->area_name?></option>
                                        <?php } ?>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>公司性质：</label>
                            <div class="col-sm-9">
                                <select class="form-control m-b" name="type" id="type">
                                    <option value="0">请选择</option>
                                    <?php foreach(config('jobsetting.type') as $key=>$val) { ?>
                                       <option value="<?=$key?>"><?=$val?></option>
                                    <?php } ?>
                                </select>

                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>公司规模：</label>
                            <div class="col-sm-9">
                                <select class="form-control m-b" name="scale" id="scale">
                                    <option value="0">请选择</option>
                                    <?php foreach(config('jobsetting.scale') as $key=>$val) { ?>
                                    <option value="<?=$key?>"><?=$val?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>所属行业：</label>
                            <div class="col-sm-9">
                                <select class="form-control m-b" name="industry_id" id="industry_id">
                                    <option value="0">请选择</option>
                                    <?php foreach($industry as $val)  {?>
                                       <option value="<?=$val->industry_id?>"><?=$val->industry_name?></option>
                                    <?php } ?>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>排序：</label>
                            <div class="col-sm-9">
                                <input type="text" value="<?=isset($detail->orderby)?$detail->orderby:''?>"
                                       placeholder="" id="orderby" name="orderby" class="form-control"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>商家介绍：</label>
                            <div class="col-sm-9">
                                <textarea name="detail" placeholder="说点什么...最少输入10个字符" id="explain" cols="50" rows="10"
                                          class="form-control"><?=isset($detail->
                                    detail)?$detail->detail:''?></textarea>
                            </div>
                        </div>
                        <link rel="stylesheet" type="text/css" href="/public/common/webuploader-0.1.5/webuploader.css">
                        <script type="text/javascript" src="/public/common/webuploader-0.1.5/webuploader.js"></script>


                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>公司LOGO：</label>
                            <div class="col-sm-9 ">

                                <div id="uploader-demo" style="max-width: 300px">
                                    <!--用来存放item-->
                                    <div id="logoList" class="uploader-list">
                                        <?php if(isset($detail['logo'])){?>
                                        <div class="file-item thumbnail"><img width="110"
                                                                              src="/attachs/uploads/<?=$detail['logo']?>"><input
                                                type="hidden" value="<?=$detail['logo']?>" name="logo" id="logo"></div>
                                        <?php }?>
                                    </div>
                                    <div id="logoPicker">选择图片</div>
                                </div>

                            </div>
                        </div>
                        <script>


                            var uploaderlogo = WebUploader.create({
                                auto: true,
                                swf: '/public/admin/Widget/webuploader-0.1.5/Uploader.swf',
                                server: '<?=url("upload.upload/index",['mdl'=>"company_logo"])?>',
                                pick: '#logoPicker',
                                resize: false,
                                duplicate: true
                            });

                            $(document).on('click', '.file-item', function () {
                                $(this).remove();
                            });

                            // 当有文件添加进来的时候
                            uploaderlogo.on('fileQueued', function (file) {
                                var $li = $(
                                    '<div id="' + file.id + '" class="file-item thumbnail">' +
                                    '<img>' +
                                    '<input type="hidden" value="" name="logo" id="logo">' +
                                    '<div class="info">' + file.name + '</div>' +
                                    '</div>'
                                    ),
                                    $img = $li.find('img');


                                // $list为容器jQuery实例
                                $("#logoList").html($li);

                                // 创建缩略图
                                // 如果为非图片文件，可以不用调用此方法。
                                // thumbnailWidth x thumbnailHeight 为 100 x 100
                                uploaderlogo.makeThumb(file, function (error, src) {
                                    if (error) {
                                        $img.replaceWith('<span>不能预览</span>');
                                        return;
                                    }

                                    $img.attr('src', src);
                                }, 100, 100);
                            });


                            // 文件上传过程中创建进度条实时显示。
                            uploaderlogo.on('uploadProgress', function (file, percentage) {
                                var $li = $('#' + file.id),
                                    $percent = $li.find('.progress span');

                                // 避免重复创建
                                if (!$percent.length) {
                                    $percent = $('<p class="progress"><span></span></p>')
                                        .appendTo($li)
                                        .find('span');
                                }

                                $percent.css('width', percentage * 100 + '%');
                            });

                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                            uploaderlogo.on('uploadSuccess', function (file, response) {
                                $('#' + file.id).addClass('upload-state-done');
                                $("#logo").val(response._raw);
                            });

                            // 文件上传失败，显示上传出错。
                            uploaderlogo.on('uploadError', function (file) {
                                var $li = $('#' + file.id),
                                    $error = $li.find('div.error');

                                // 避免重复创建
                                if (!$error.length) {
                                    $error = $('<div class="error"></div>').appendTo($li);
                                }

                                $error.text('上传失败');
                            });

                            // 完成上传完了，成功或者失败，先删除进度条。
                            uploaderlogo.on('uploadComplete', function (file) {
                                $('#' + file.id).find('.progress').remove();
                            });

                        </script>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>审核证件图片：</label>
                            <div class="col-sm-9 ">
                                <div id="uploader-demo" style="max-width: 300px">
                                    <!--用来存放item-->
                                    <div id="audit_photoList" class="uploader-list">
                                        <?php if(isset($detail['audit_photo'])){?>
                                        <div class="file-item thumbnail"><img width="110"
                                                                              src="/attachs/uploads/<?=$detail['audit_photo']?>"><input
                                                type="hidden" value="<?=$detail['audit_photo']?>" name="audit_photo"
                                                id="audit_photo"></div>
                                        <?php }?>
                                    </div>
                                    <div id="audit_photoPicker">选择图片</div>
                                </div>
                            </div>
                        </div>
                        <script>
                            var uploaderaudit_photo = WebUploader.create({
                                auto: true,
                                swf: '/public/admin/Widget/webuploader-0.1.5/Uploader.swf',
                                server: '<?=url("upload.upload/index",['mdl'=>"company_audit_photo"])?>',
                                pick: '#audit_photoPicker',
                                resize: false,
                                duplicate: true
                            });

                            $(document).on('click', '.file-item', function () {
                                $(this).remove();
                            });

                            // 当有文件添加进来的时候
                            uploaderaudit_photo.on('fileQueued', function (file) {
                                var $li = $(
                                    '<div id="' + file.id + '" class="file-item thumbnail">' +
                                    '<img>' +
                                    '<input type="hidden" value="" name="audit_photo" id="audit_photo">' +
                                    '<div class="info">' + file.name + '</div>' +
                                    '</div>'
                                    ),
                                    $img = $li.find('img');


                                // $list为容器jQuery实例
                                $("#audit_photoList").html($li);

                                // 创建缩略图
                                // 如果为非图片文件，可以不用调用此方法。
                                // thumbnailWidth x thumbnailHeight 为 100 x 100
                                uploaderaudit_photo.makeThumb(file, function (error, src) {
                                    if (error) {
                                        $img.replaceWith('<span>不能预览</span>');
                                        return;
                                    }

                                    $img.attr('src', src);
                                }, 100, 100);
                            });


                            // 文件上传过程中创建进度条实时显示。
                            uploaderaudit_photo.on('uploadProgress', function (file, percentage) {
                                var $li = $('#' + file.id),
                                    $percent = $li.find('.progress span');

                                // 避免重复创建
                                if (!$percent.length) {
                                    $percent = $('<p class="progress"><span></span></p>')
                                        .appendTo($li)
                                        .find('span');
                                }

                                $percent.css('width', percentage * 100 + '%');
                            });

                            // 文件上传成功，给item添加成功class, 用样式标记上传成功。
                            uploaderaudit_photo.on('uploadSuccess', function (file, response) {
                                $('#' + file.id).addClass('upload-state-done');
                                $("#audit_photo").val(response._raw);
                            });

                            // 文件上传失败，显示上传出错。
                            uploaderaudit_photo.on('uploadError', function (file) {
                                var $li = $('#' + file.id),
                                    $error = $li.find('div.error');

                                // 避免重复创建
                                if (!$error.length) {
                                    $error = $('<div class="error"></div>').appendTo($li);
                                }

                                $error.text('上传失败');
                            });

                            // 完成上传完了，成功或者失败，先删除进度条。
                            uploaderaudit_photo.on('uploadComplete', function (file) {
                                $('#' + file.id).find('.progress').remove();
                            });

                        </script>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>审核状态：</label>
                            <div class="col-sm-9">
                                <div class="radio i-checks">
                                    <label>
                                        <input name="audit" id="audit" value="1" type="radio" <?php if(isset($detail->
                                        audit)&& $detail->audit==1){?>checked="checked"<?php }?> > <i></i> 是</label>
                                    <label>
                                        <input name="audit" id="audit" value="0" type="radio" <?php if(isset($detail->
                                        audit)&& $detail->audit==0){?>checked="checked"<?php }?> > <i></i> 否</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label no-padding-right"><span
                                    class="c-red">*</span>是否已上市：</label>
                            <div class="col-sm-9">
                                <div class="radio i-checks">
                                    <label>
                                        <input name="is_gopublic" id="is_gopublic" value="1" type="radio" <?php if(isset($detail->
                                        audit)&& $detail->audit==1){?>checked="checked"<?php }?> > <i></i> 是</label>
                                    <label>
                                        <input name="is_gopublic" id="is_gopublic2" value="0" type="radio" <?php if(isset($detail->
                                        audit)&& $detail->audit==0){?>checked="checked"<?php }?> > <i></i> 否</label>
                                </div>
                            </div>
                        </div>

                        <div class="clearfix form-actions">
                            <div class="col-md-offset-3 col-md-9">
                                <button mini="submit" for="form-create" class="btn btn-info" type="button">
                                    <i class="ace-icon fa fa-check bigger-110"></i>
                                    保存
                                </button>
                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>